// ----------------------企业中心----------------------
import fetch from '../config/fetch';
const pageSize = 10;

/**
 * 设置组织的基础信息
 * params: {
  "infoAbb": "string",  //简称
  "infoEndDate": "2019-03-07T01:13:47.662Z",  // 截至日期
  "infoIsPerpetual": true,  // 是否长期
  "infoLisenceImg": "string", // 执照照片
  "infoLisenceSn": "string",  // 统一执照信用代码
  "infoLocAddress": "string", // 详细地址
  "infoLocCityId": 0, // 城市
  "infoLocCountryId": 0,  //国家
  "infoLocDistrictId": 0, // 区
  "infoLocProvinceId": 0, // 省
  "infoName": "string", // 名称
  "infoScope": "string" // 经营范围
}
 */
export const setBaseInfo = (data) => fetch({
  url: '/organization/v1/setBaseInfo',
  method: "put",
  data: JSON.stringify(data),
});

/**
 * 设置组织的账号信息
 * params: {
  "accAlipay": "string",
  "accBankBackId": 0,
  "accBankBranchId": 0,
  "accBankCityId": 0,
  "accBankName": "string",
  "accBankProvinceId": 0,
  "accBankSn": "string"
}
 */
export const setAccount = (data) => fetch({
  url: '/organization/v1/setAccount',
  method: "put",
  data: JSON.stringify(data),
});

/**
 * 设置组织的账号信息
 * params: {
  "accAlipay": "string",
  "accBankBackId": 0,
  "accBankBranchId": 0,
  "accBankCityId": 0,
  "accBankName": "string",
  "accBankProvinceId": 0,
  "accBankSn": "string"
}
 */
export const setOrganizationInfo = (data) => fetch({
  url: '/organization/v1/setOrganizationInfo',
  method: "put",
  data: JSON.stringify(data),
});

/**
 * 设置组织的法人信息
 * params: {
  "elpCcEndDate": "2019-03-07T01:13:47.662Z", 
  "elpCcImgEnd": "string",
  "elpCcImgFont": "string",
  "elpCcIsPerpetual": true,
  "elpCcSn": "string"
}
 */
export const setLegalPerson = (data) => fetch({
  url: '/organization/v1/setLegalPerson',
  method: "put",
  data: JSON.stringify(data),
});

/**
 * 设置组织的业务员信息
 * params: {
  "contactsCellPhone": "string",
  "contactsIsPublic": true,
  "contactsName": "string",
  "contactsPhone": "string",
  "contactsPhoneSubsn": "string",
  "contactsQq": "string",
  "contactsWechat": "string"
}
 */
export const setBusiness = (data) => fetch({
  url: '/organization/v1/setBusiness',
  method: "put",
  data: JSON.stringify(data),
});

/**
 * 设置组织的邮箱
 * params: {
  "newPassword": "string",
  "oldPassword": "string"
}
 */
export const setEmail = (email) => fetch({
  url: '/organization/v1/account/setEmail',
  method: "put",
  data: JSON.stringify({
    "email": email
  }),
});

/**
 * 重置组织的密码
 * params: {
  "newPassword": "string",
  "oldPassword": "string"
}
 */
export const setPassword = (data) => fetch({
  url: '/organization/v1/account/setPassword',
  method: "put",
  data: JSON.stringify(data),
});

/**
 * 获取当前登录企业信息
 */
export const getOrganization = () => fetch({
  url: '/organization/v1/owner',
  method: "get",
  data: {},
});

/**
 * 获取当前登录企业信息
 */
export const getOrganizationById = (id) => fetch({
  url: '/organization/v1/' + id,
  method: "get",
  data: {},
});

/**
 * 激活组织机构
 */
export const setActivated = (id, data) => fetch({
  url: '/organization/v1/' + id + '/check',
  method: "put",
  data: JSON.stringify(data),
});


/**
 * 提交企业信息到平台审核
 */
export const putActivated = () => fetch({
  url: '/organization/v1/commitCheck',
  method: "put",
  data: {},
});


// -------客服--------

/**
 * 获取企业客服列表
 */
export const getContact = (pageNumber) => fetch({
  url: '/organization/v1/contact',
  method: "get",
  data: {},
});

/**
 * 添加客服
 */
export const addContact = (data) => fetch({
  url: '/organization/v1/contact',
  method: "post",
  data: { "phones": data },
});

/**
 * 删除客服
 */
export const deleteContact = (id) => fetch({
  url: '/organization/v1/contact/' + id,
  method: "delete",
  data: {},
});

// -------客服--------


// -------管理员--------

/**
 * 获取企业管理员列表
 */
export const getManager = (pageNumber) => fetch({
  url: '/organization/v1/manager',
  method: "get",
  data: {},
});

/**
 * 添加管理员
 */
export const addManager = (data) => fetch({
  url: '/organization/v1/manager',
  method: "post",
  data: { "phones": data },
});

/**
 * 删除管理员
 */
export const deleteManager = (id) => fetch({
  url: '/organization/v1/manager/' + id,
  method: "delete",
  data: {},
});

// -------管理员--------